﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TSAP03  
    { 
        public TSAP03()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VAPFOLGE();
            DataContext = MV;
            InitializeComponent();
        }

        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
             if (dwMaster != null)
            {
                WH = dwMaster["KSZLO"].ToString() + dwMaster["KSZLB"].ToString() + dwMaster["KSZLP"].ToString(); 
            }
            else
            {
                WH = "";
            }
        }
        public override void OnEXAUFChg(string vlaue)
        {
            if (EXAUF.Length < 8)
                return;
            if (KEY.PadRight(8).Substring(0, 8) == EXAUF.PadRight(8).Substring(0, 8))
            {
                string wh = WH;
                WH = "";
                WH = wh;
                return;
            }
               
            TBMain.Clear();
            if (EXAUF.Length < 8)
                return;
            dwData = TBMain.NewRow();
            dwData["APFMANDANT"] = app.Mandant;
            dwData["APFANRKRS"] = EXAUF.Substring(0, 2);
            dwData["APFALFDNR"] = EXAUF.Substring(2, 6);
            SResult = TMV.QAPF08(dwData);
            MergeData(SResult, true);

            base.OnEXAUFChg(vlaue);
        } 
    }
}
